Skip to content

feat: add plot/charts/scatter/ctor - #14299

Open
Sachinn-64 wants to merge 4 commits into
stdlib-js:refactor/plotfrom
Sachinn-64:plot-charts-scatter
Open

feat: add plot/charts/scatter/ctor#14299
Sachinn-64 wants to merge 4 commits into
stdlib-js:refactor/plotfrom
Sachinn-64:plot-charts-scatter

Conversation

@Sachinn-64

@Sachinn-64 Sachinn-64 commented Aug 15, 2026

Copy link
Copy Markdown
Member
Screenshot 2026-08-15 at 10 42 51 PM type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---

Resolves None.

Description

What is the purpose of this pull request?

This pull request:

  • feat: add plot/charts/scatter/ctor

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

  • None

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

{{TODO: add disclosure if applicable}}


@stdlib-js/reviewers

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@Sachinn-64 Sachinn-64 added GSoC Google Summer of Code. gsoc: 2026 Google Summer of Code (2026). labels Aug 15, 2026
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 15, 2026
Comment thread lib/node_modules/@stdlib/plot/charts/scatter/ctor/lib/legend/set.js Outdated
Comment thread lib/node_modules/@stdlib/plot/charts/scatter/ctor/lib/defaults.js Outdated
Comment thread lib/node_modules/@stdlib/plot/charts/scatter/ctor/lib/defaults.js Outdated
Comment thread lib/node_modules/@stdlib/plot/charts/scatter/ctor/package.json Outdated
Comment thread lib/node_modules/@stdlib/plot/charts/scatter/ctor/lib/main.js Outdated
Comment thread lib/node_modules/@stdlib/plot/charts/scatter/ctor/lib/main.js Outdated
Comment thread lib/node_modules/@stdlib/plot/charts/scatter/ctor/lib/main.js Outdated
Comment thread lib/node_modules/@stdlib/plot/charts/scatter/ctor/examples/index.js Outdated

@kgryte kgryte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left initial comments.

@kgryte

kgryte commented Aug 15, 2026

Copy link
Copy Markdown
Member

@Sachinn-64 Interestingly, in your demo plot above, the legend shows the symbols, but all the plot markers are dots.

function encoding( name, scales ) {
return new SymbolEncoding({
'update': new SymbolEncodingSet({
'fill': ordinalValue( getScale( scales, 'color' ), name ),

@kgryte kgryte Aug 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so this is an interesting one. For certain symbols, they should not be filled. E.g., I should be able to create an unfilled circle. Meaning, we encode the stroke, but not the fill. That is the intent behind distinguishing "circle" (unfilled) from "dot" (filled).

One could argue that we should be able to do the same for filled and unfilled triangles, stars, diamonds, etc.

But then some symbols don't have a fill (e.g., stroke, asterisk, cross, x, etc).

I am not sure how we should handle this. MATLAB makes a distinction between "face" (i.e., fill) and "edge" (i.e., stroke) color. Ref: https://www.mathworks.com/help/matlab/ref/scatter.html

At least in MATLAB, if you specify "filled", certain symbols which don't have "faces" don't work.

My initial thinking is that we need a separate property to allow specifying fill colors independently of edge/stroke colors.

In which case, we could have the following properties:

  • legend: toggle legend
  • symbols: symbol shapes (shape)
  • colors: primary symbol colors (fill)
  • edgeColors: edge colors for those symbols supporting edges (e.g., triangle, circle, diamond, etc) (stroke)
  • symbolOpacity: symbol opacities (fillOpacity)
  • edgeOpacity: edge opacities (strokeOpacity)
  • symbolSize: symbol sizes (size)
  • edgeWidth: edge widths (strokeWidth)

We should allow the "edge" properties to be unset (i.e., explicitly set to undefined). Modulo logic still applies for the edge* properties. For those symbols which are all "edge", such as stroke or cross, edgeColors should take precedent over colors.

This means that the encoding logic will be a bit more complicated than what is done here and will depend on what has been set. E.g., if edgeWidth has not been set, we should not encode a strokeWidth property.

Does that make sense?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm...we'd also need to support "unsetting" the colors property, I suppose, in order to support "hollow" symbols.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another follow-up: given the direction of being able to independently set fill and edge color, that makes the distinction between circle and dot less necessary, unless dot truly is a "dot" (individual pixel), which I could see being potentially useful for very large datasets. That may require updating the SVG path string accordingly.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. Feature Issue or pull request for adding a new feature. and removed Needs Review A pull request which needs code review. labels Aug 16, 2026
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: passed
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@Sachinn-64
Sachinn-64 requested a review from kgryte August 16, 2026 08:11
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 16, 2026
Comment thread lib/node_modules/@stdlib/plot/charts/scatter/ctor/lib/main.js
Comment thread lib/node_modules/@stdlib/plot/charts/scatter/ctor/lib/main.js Outdated
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>

@kgryte kgryte left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good. Now, you just need to add "edge" support.

@kgryte kgryte removed the Needs Review A pull request which needs code review. label Aug 16, 2026
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: passed
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@Sachinn-64
Sachinn-64 requested a review from kgryte August 17, 2026 07:41
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 17, 2026
@kgryte kgryte removed the Needs Changes Pull request which needs changes before being merged. label Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Issue or pull request for adding a new feature. GSoC Google Summer of Code. gsoc: 2026 Google Summer of Code (2026). Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants